<template>
  <div class="wapper" v-if="showSwiper">
    <swiper :options="swiperOption">
      <swiper-slide v-for="item of swiperList" :key="item.id">
        <a :href="item.linkUrl">
          <img class="swiper-img" :src="item.picUrl">
        </a>
      </swiper-slide>
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
export default {
  name: 'RecommendSwiper',
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: 4000
      }
    }
  },
  computed: {
    showSwiper () {
      return this.swiperList.length
    }
  }
}
</script>
<style lang="stylus" scoped>
.wapper >>> .swiper-pagination-bullet-active
  background-color #fff
  height: 8px;
  width 20px
  border-radius 4px
.wapper
  overflow hidden
  width 100%
  padding-bottom 40%
  height 0
  background-color #eeeeee
  .swiper-img
    width 100%
</style>
